// license-header java merge-point
/**
 * This is only generated once! It will never be overwritten.
 * You can (and have to!) safely modify it by hand.
 */
package org.tinaelle.server.domain;
/**
 * @see org.tinaelle.server.domain.AdElement
 */
public class AdElementDaoImpl
    extends org.tinaelle.server.domain.AdElementDaoBase
{
    /**
     * @see org.tinaelle.server.domain.AdElementDao#toAdElementDTO(org.tinaelle.server.domain.AdElement)
     */
    public org.tinaelle.common.dto.AdElementDTO toAdElementDTO(final org.tinaelle.server.domain.AdElement entity)
    {
        return super.toAdElementDTO(entity);
    }

    /**
     * Retrieves the entity object that is associated with the specified value object
     * from the object store. If no such entity object exists in the object store,
     * a new, blank entity is created
     */
    private org.tinaelle.server.domain.AdElement loadAdElementFromAdElementDTO(org.tinaelle.common.dto.AdElementDTO adElementDTO)
    {
        org.tinaelle.server.domain.AdElement adElement = this.load(adElementDTO.getAdElementId());
        if (adElement == null)
        {
            adElement = org.tinaelle.server.domain.AdElement.Factory.newInstance();
        }
        return adElement;
    }

    
    /**
     * @see org.tinaelle.server.domain.AdElementDao#adElementDTOToEntity(org.tinaelle.common.dto.AdElementDTO)
     */
    public org.tinaelle.server.domain.AdElement adElementDTOToEntity(org.tinaelle.common.dto.AdElementDTO adElementDTO)
    {
        org.tinaelle.server.domain.AdElement entity = this.loadAdElementFromAdElementDTO(adElementDTO);
        this.adElementDTOToEntity(adElementDTO, entity, true);
        return entity;
    }
}